import 'package:get/get.dart';

// 瀑布流数据模型 - 支持图片和活动
class WaterfallItem {
  final String id;
  final String type; // 支持 'image' 和 'activity'
  final String coverUrl;
  final List<String> imageUrls;
  final String title;
  final String description;
  final String authorName;
  final String authorAvatar;
  final int likeCount;
  final int commentCount;
  final int dislikeCount;
  final double aspectRatio;
  
  // 活动专用字段（可选）
  final String? location;
  final String? distance;
  final String? time;
  final String? activityType;
  final String? activityTags;
  final String? participants;
  final String? publishTime;
  final String? status;
  final int? publisherId;     // 发布者ID
  final int? currentUserId;   // 当前用户ID
  final String? gender;       // 发布者性别
  final double? latitude;     // 活动纬度
  final double? longitude;    // 活动经度
  final List<String>? activityRestriction; // 活动性别限制

  WaterfallItem({
    required this.id,
    required this.type,
    required this.coverUrl,
    required this.imageUrls,
    required this.title,
    required this.description,
    required this.authorName,
    required this.authorAvatar,
    required this.likeCount,
    required this.commentCount,
    required this.dislikeCount,
    required this.aspectRatio,
    // 活动专用字段（可选）
    this.location,
    this.distance,
    this.time,
    this.activityType,
    this.activityTags,
    this.participants,
    this.publishTime,
    this.status,
    this.publisherId,
    this.currentUserId,
    this.gender,
    this.latitude,
    this.longitude,
    this.activityRestriction,
  });
}

class HomeState {
  // 是否加载中
  late RxBool isLoading;
  
  // 轮播图列表
  final banners = <String>[].obs;
  
  // 消息数量
  final messageCount = 0.obs;
  
  // 文章列表
  late RxList<Map<String, dynamic>> articles;
  
  // 文章列表相关状态
  late RxBool isLoadingArticles;
  late RxInt currentPage;
  late RxInt totalPages;
  late RxBool hasMoreArticles;
  
  // 瀑布流数据
  final waterfallItems = <WaterfallItem>[].obs;
  final isLoadingWaterfall = false.obs;
  final hasMoreWaterfall = true.obs;
  final waterfallPage = 1.obs;
  
  // 用户气泡数据
  final userBubbles = <Map<String, dynamic>>[
    {
      'name': 'test',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_1.webp',
      'offsetX': 0.0,
      'offsetY': -20.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '雪拥楼梯大',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_2.webp',
      'offsetX': -120.0,
      'offsetY': 0.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '可爱的你',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_3.webp',
      'offsetX': -60.0,
      'offsetY': 50.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '哈哈',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_4.webp',
      'offsetX': 120.0,
      'offsetY': 0.0,
      'checkInCount': 2,
      'commentCount': 1,
    },
    {
      'name': '小鱼儿',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_5.webp',
      'offsetX': 60.0,
      'offsetY': 50.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '声三声汁',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_6.webp',
      'offsetX': -60.0,
      'offsetY': -50.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '青青点点',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_7.webp',
      'offsetX': 60.0,
      'offsetY': -50.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
    {
      'name': '哈哈哈哈',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_8.webp',
      'offsetX': 0.0,
      'offsetY': 70.0,
      'checkInCount': 0,
      'commentCount': 1,
    },
  ].obs;

  // 附近点评数据
  final nearbyReviews = <Map<String, dynamic>>[
    {
      'id': '1',
      'content': '新鱼对于一个不怎么吃辣的人来说巨辣，推荐部骨、烤粉和生菜',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_9.webp',
      'username': '夏日沫沫茶',
      'role': '守护者',
      'likeCount': 0,
      'commentCount': 1,
      'reviewImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_13.webp',
      'comments': [
        {
          'id': '1',
          'userId': '2015',
          'username': '用户2015',
          'avatar': '',
          'content': '11',
          'createdAt': '2025-01-17T10:30:00Z',
        },
      ],
    },
  ].obs;

  // 最新排名动态数据
  final latestActivities = <Map<String, dynamic>>[
    {
      'username': '哈哈',
      'title': '最新评论:大佬们好',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_10.webp',
      'userId': '用户7386',
      'time': '2025-06-27 15:56:42',
      'content': '非常好',
      'comments': 1,
      'likes': 1,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_14.webp',
    },
    {
      'username': 'test',
      'title': '最新评论:特特看书',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_11.webp',
      'userId': '用户2298',
      'time': '2025-06-27 11:06:51',
      'content': 'test测试',
      'comments': 1,
      'likes': 1,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_16.webp',
    },
    {
      'username': '可爱的你',
      'title': '最新评论:闹包鱼子酱',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_3.webp',
      'userId': '茉莉',
      'time': '2025-06-02 11:54:02',
      'content': '别有风味的吃法',
      'comments': 1,
      'likes': 1,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/post/31.jpg',
    },
    {
      'username': '雪拥楼梯大',
      'title': '最新评论:城市夜景',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_2.webp',
      'userId': '风铃',
      'time': '2025-05-28 19:22:15',
      'content': '美丽的夜景让人陶醉',
      'comments': 3,
      'likes': 5,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/post/21.jpg',
    },
    {
      'username': '小鱼儿',
      'title': '最新评论:美酒配美食',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_5.webp',
      'userId': '追随者',
      'time': '2025-05-26 20:15:33',
      'content': '这家的调酒真的很特别，强烈推荐',
      'comments': 2,
      'likes': 7,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/post/51.jpg',
    },
    {
      'username': '青青点点',
      'title': '最新评论:周末聚会',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_7.webp',
      'userId': '守护者',
      'time': '2025-05-25 21:42:18',
      'content': '朋友们的欢聚时光，气氛超棒',
      'comments': 4,
      'likes': 9,
      'dislikes': 0,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/post/71.jpg',
    },
    {
      'username': '声三声汁',
      'title': '最新评论:创意鸡尾酒',
      'avatar': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/user_test/user_6.webp',
      'userId': '追随者',
      'time': '2025-05-20 18:30:45',
      'content': '视觉与味觉的双重享受',
      'comments': 3,
      'likes': 12,
      'dislikes': 1,
      'contentImage': 'https://bai-ying.oss-cn-qingdao.aliyuncs.com/image/post/62.jpg',
    },
  ].obs;
} 